<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">
                    任务设置
                </div>
                <div class="layui-card-body" pad15="">
                    <div class="layui-tab">
                        <ul class="layui-tab-title">
                            <li class="layui-this">
                                基本配置
                            </li>
                            <li>
                                信用配置
                            </li>
                            <li>
                                paypal配置
                            </li>
                        </ul>
                        <div class="layui-tab-content">
                            <!--基本配置开始-->
                            <div class="layui-tab-item layui-show">
                                <div class="layui-form" lay-filter="" wid100="">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">
                                            需求方可看投稿数
                                        </label>
                                        <div class="layui-input-block">
                                            <input class="layui-input" name="view_able" type="text" value="{$cfg.view_able}">
                                            </input>
                                            %
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">
                                            多少金币可兑换1块美金
                                        </label>
                                        <div class="layui-input-block">
                                            <input class="layui-input" name="money_to_cash" type="text" value="{$cfg.money_to_cash}">
                                            </input>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">
                                            客服电话：
                                        </label>
                                        <div class="layui-input-block">
                                            <input class="layui-input" name="service[phone]" type="text" value="{$cfg.service.phone}"/>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">
                                            客服邮箱：
                                        </label>
                                        <div class="layui-input-block">
                                            <input class="layui-input" name="service[email]" type="text" value="{$cfg.service.email}"/>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-md2 layui-col-md-offset10">
                                            <div class="layui-input-block">
                                                <button class="layui-btn" lay-filter="form_submit" lay-submit="">
                                                    确认保存
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--信用配置开始-->
                            <div class="layui-tab-item">
                                <div class="layui-form layui-row " lay-filter="" wid100="">
                                    {foreach $credit as $k=>$v}
                                    <div class="layui-col-md3" style="height: 150px">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">
                                                {$v[0]}：
                                            </label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input" name="{$k}" type="text" value="{$v[1]}"/>
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">
                                                分
                                            </div>
                                        </div>
                                    </div>
                                    {/foreach}
                                    <div class="layui-form-item">
                                        <div class="layui-col-md2 layui-col-md-offset10">
                                            <div class="layui-input-block">
                                                <button class="layui-btn" lay-filter="form_submit_credit" lay-submit="">
                                                    确认保存
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--信用配置结束-->
                            <!--paypal配置开始-->
                            <div class="layui-tab-item">
                                <div class="layui-form layui-row " lay-filter="" wid100="">
                                    <div class="layui-col-md12">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">
                                                client ID：
                                            </label>
                                            <div class="layui-input-block">
                                                <input class="layui-input" name="client_id" type="text" value="{$paypal.client_id}"/>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-col-md12">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">
                                                Client Secret：
                                            </label>
                                            <div class="layui-input-block">
                                                <input class="layui-input" name="client_secret" type="text" value="{$paypal.client_secret}"/>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-col-md12">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">
                                                sandbox：
                                            </label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input" name="sandbox" type="text" value="{$paypal.sandbox|default=1}"/>
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">
                                                沙盒测试模式1，否则改0
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-md2 layui-col-md-offset10">
                                            <div class="layui-input-block">
                                                <button class="layui-btn" lay-filter="form_submit_paypal" lay-submit="">
                                                    确认保存
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--paypal配置结束-->
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['index','form','element'],function(index){
     var $ = layui.$;   
     var form = layui.form;  
     var _act = layui.setter.app_url+'missionset/update';    
     var _act_credit = layui.setter.app_url+'missionset/updateCredit';    
     var _act_paypal = layui.setter.app_url+'missionset/updatePaypal';    
     form.on("submit(form_submit)",function(data){
        $.post(_act, data.field, function(res, textStatus, xhr) {
           layer.msg(res.msg);            
        });
     })  

     form.on("submit(form_submit_credit)",function(data){
        $.post(_act_credit, data.field, function(res, textStatus, xhr) {
           layer.msg(res.msg);            
        });
     }) 

      form.on("submit(form_submit_paypal)",function(data){
        $.post(_act_paypal, data.field, function(res, textStatus, xhr) {
           layer.msg(res.msg);            
        });
     }) 
  });
</script>
